$(function() {
	
	centEvent = {
        init : function () {
        	
        	centEvent.editEvent();
        	centEvent.saveEvent();
        },
        
        /* 行数据 checkbox 事件bind*/
        editEvent : function (){
			$("#right03 .agen_right_title a").click(function(){
				try {
					
					tinymce.remove("textarea");
					
					$("#right03").hide();
					 tinymce.init({
						   selector: "textarea",
						   theme: "modern",
					       language :"zh_CN",
					       external_plugins: {
								"image": contextRootPath + "/js/tinymce/plugins/image/plugin.min.js"
							},
					       image_advtab:true
					    });
					 $("#centEdit").show();
					
				} catch (e) {
					
					$("#right03").hide();
					 tinymce.init({
						   selector: "textarea",
						   theme: "modern",
					       language :"zh_CN",
					       external_plugins: {
								"image": contextRootPath + "/js/tinymce/plugins/image/plugin.min.js"
							},
					       image_advtab:true
					    });
					 $("#centEdit").show();
				}
				
				
				
			});
		},
        /* 添加info 保存事件bind*/
		saveEvent : function (){
			$("#cent_save").click(function(){
				var title = $("input").eq(0).val();
				var DB_id = $("#DB_id").val();
				var content = tinymce.get('htmEdit').getContent();
				if('' == $.trim(title)) {
					alert('请输入标题!');
					return false;
				}
				if('' == $.trim(content)) {
					alert('请输入正文!');
					return false;
				}
				$.ajax({
	    			  type: "POST",
	    			  url: contextRootPath + "/introduce/saveIntroduce",
	    			  data:JSON.stringify({"introduceTitle": title, "introduceTxt": content,'id': DB_id}),
	    			  dataType: "html",
	    			  contentType: "application/json; charset=utf-8",
	    			  success: function(data){
	    				  /** 成功构造内容**/
	    				   $("#contentdiv").html(data);
	    				   centEvent.init();
		    			   alert("添加成功");
	    			 }
				});
				
			});
		},
	   
}
	
});


 